package kr.co.icebird.swt.app.ch5;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;

public class Ch5_Capitalizer extends Composite {

	public Ch5_Capitalizer(Composite parent) {
		super(parent, SWT.NONE);
		buildControls();
	}

	private void buildControls() {
		this.setLayout(new FillLayout());
		Text text = new Text(this, SWT.MULTI | SWT.V_SCROLL);

		text.addVerifyListener(new VerifyListener() {

			public void verifyText(VerifyEvent e) {
				if (e.text.startsWith("1")) {
					e.doit = false;
				} else {
					e.text = e.text.toUpperCase();
				}
			}
		});
	}

}
